class Solution {
public:
vector<int>ret;
    vector<int> rightSideView(TreeNode* root) {
    queue<TreeNode*>st;
    if(root!=nullptr)
     {st.push(root);}

    while(st.size())
    {
     int sz=st.size();
     vector<int>pp;
     for(int i=0;i<sz;i++)
     {
         TreeNode*find=st.front();
         
         st.pop();
         pp.push_back(find->val);
         if(find->left)
         {st.push(find->left);}
         if(find->right)
         {st.push(find->right);}

     }
       ret.push_back(pp.back());
        // cout<<pp[pp.size()-1]<<" "<<endl;
    }     
       return ret;





    }
};class Solution {
public:
    int val=INT_MAX;
    TreeNode*prev=nullptr;
    void getvalue(TreeNode* root)
    {
     if(root==nullptr)
     return ;
     getvalue( root->left);
     if(prev!=nullptr)
     {
          val=min(val,root->val-prev->val);
 
     }
     prev=root;
     getvalue( root->right);
     


    }
    int getMinimumDifference(TreeNode* root) {
     
      getvalue(root);
      return val;

    }
};class Solution {
public:
TreeNode*prev=nullptr;
    int val=LLONG_MIN;
      bool isValidBST(TreeNode* root) 
    {
      if(root==nullptr)return true;

     if(!isValidBST(root->left))
     return false;
     if(root->val<=val)return false;
      val=root->val;
     
     if(!isValidBST(root->right))
     return false;

    return true;
    }
  
    
     
      


};